package com.hcx.poi.xssf.eventmodel.sheethandler;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.hcx.xml.sax.ElementContentHandler;

/**
 * 处理 Sheet#.xml 中的 /worksheet/sheetData/row/c/v 元素
 * @author hancx_sinosoft
 *
 */
public class SheetCellValueContentHandler implements ElementContentHandler {

	private SheetCellContentHandler cellHandler;
	
	public SheetCellValueContentHandler(SheetCellContentHandler cellHandler){
		this.cellHandler = cellHandler;
	}
	
	@Override
	public void startElement(String uri, String localName, String qName,
			Attributes atts) throws SAXException {
	}

	@Override
	public void endElement(String uri, String localName, String qName,
			String content) throws SAXException {
		if(null != cellHandler){
			cellHandler.setCellValue(content);
		}
	}

	@Override
	public boolean isTextElement() {
		return true;
	}

	@Override
	public String getHandlePath() {
		return "/worksheet/sheetData/row/c/v";
	}

}
